package com.function.study;

/**
 * @program: study
 * @className: RecursiveFactorial
 * @description: TODO
 * @author: kukuxiahuni
 * @create: 2019-12-16 09:58
 * @version: v1.0
 **/


/**
 * 功能描述: 阶乘测试
 *
 * @param:
 * @return:
 * @auther: kukuxiahuni
 * @date: 2019/12/16 10:00 上午
 * @modify_auther: kukuxiahuni
 * @modify_time: 2019/12/16 10:00 上午
 **/
public class RecursiveFactorial {

    private InterCall interCall;

    public RecursiveFactorial() {
        this.interCall = n -> n == 0 ? 1 : n * this.interCall.call(n - 1);
    }

    public static void main(String[] args) {

        RecursiveFactorial recursiveFactorial = new RecursiveFactorial();

        for (int i = 0; i <= 10; i++) {
            System.out.println(recursiveFactorial.interCall.call(i));
        }
    }
}
